Welcome to Mr. Zuberi's Introduction to Computer Science 11 University Preparation Course!




Course Outline:


Tests or Assignments (small or large projects) - Due Dates and Test Dates:

Friday, Sept. 21, 2012, Quiz on everything we have covered so far
Wednesday, Oct. 3, 2012, Quiz on String methods, increments, variable updates and user input/output programming
Thursday, Oct. 11, 2012, Quiz on If-Else Statements / Boolean Logic (which includes all material covered in the course)

Monday, October 22, 2012 - Quiz on while loops, for loops, boolean.

Monday, November 12, 2012: Quiz on Classes and Objects

Friday, November 30, 2012 Quiz on Computers in Society.
Quiz on Arrays on Monday, Dec. 10, 2012

EXAM: Thursday, January 17, 2013, Rm 6, 1 - 3 PM





Homework


EXAM REVIEW WEEK

Day 1 - Monday, January 7, 2013

Components of a Computer

Q# Write a program that asks a user which component of the computer they would like to know about. The user should enter the component name as a String through the keyboard. The program then provides them one line of information and then asks the user if they want to know more. If the user wants to know more, it provides them a second line of information about the component. The program should have a break statement that brings the user out of the loop and thanks them for using the program.



Day 2 - Tuesday, January 8, 2013

Simple programs -

Day 3 - Wednesday, January 9, 2013

Practicing If-else statements, for loops

Day 4 - Thursday, January 10, 2013

Practicing loops, public classes and methods.

Day 5- Friday, January 11, 2013

Practicing public classes, methods, and arrays.






Dec. 24 to Jan. 4, 2013 - EXAM Practice Problems over the HOLIDAYS!

Instructions: Answer these questions using paper and pencil. You may use Java to check your work.

1. In Java, what lines of code do not end with a semi-colon? For example, the following line,
public static void main (String [] args)
does not end with a semi-colon. Generally describe or list all the lines that do not end with a semi-colon.

2. Consider an integer called x. What is difference between x++ and x-- ?

3. What is the difference between a for loop and a while loop?

4. Using a for loop, write a code that outputs
23.5
25.5
27.5
29.5

5. Using a while loop, write a code that outputs
88
89
90
91
92

6. Using a while loop, write a code that allows the user to enter words. Only if the user enters "quit", the loop should end followed by a "thank you for using our program" statement outputted to the screen.

7. Write a code using a for loop that prints the sum of seven numbers entered by the user.

8. What does the following code mean in terms of what valid inputs are allowed?

if ((100.5 < x) && (x < 107.5))
{
System.out.println("these are valid inputs");
}
else
{
System.out.println("Invalid");
}

9. Write a code that gives a user up to three chances to enter a correct fuel load for a rocket. A valid fuel load must be between 590.3 to 643.1 liters.

10. This question is concerned with object oriented program which is what we did before the careers assignment. Two files Java files (or programs) are made, one file has instance variables and methods whereas the other file is the main program that runs the first file. For file #1, create two decimal instance variables: numA and numB. Four public methods should be created for addition, subtraction, multiplication, and division, for these two instance variables. For file #2, an object needs to be created that represents the first file and makes use of the four methods.

11. Summarize your careers assignment into three-quarters of a page.


Tuesday, Dec. 18, 2012
JAVA PRACTICE

Tuesday, Dec. 11 - Wednesday, Dec. 19, 2012
Work on the computer studies / careers assignment.

Monday, Dec. 10, 2012
We had a quiz on arrays

Thursday, Dec. 6, 2012
Today, we will review public methods and write a class that will be used in an array.
Quiz on Arrays on Monday, Dec. 10, 2012

Wednesday, Dec. 5, 2012
Quiz on Arrays on Monday, Dec. 10, 2012

Complete the following computer studies / careers assignment:
http://northern.lkdsb.net/kedwell/ics3u/Unit_Society/Careers_Research_ICS3U_2011.htm
It is due on Wednesday, Dec. 19, 2012.
It must be five pages in length (double-spaced) followed by a bibliography.
Your paper must be based on a topic available in the web link above.

Tuesday, Dec. 4, 2012
Quiz on Arrays on Monday, Dec. 10, 2012
Homework Questions:

1. What output will be produced by the following code?

int i;
int[ ] a = new int[10];
for (i=0; i < a.length; i++)
{
a[i] = 2*i;
}
for (i=0; i< a.length; i++)
{
System.out.println(a[i] + " ");
}
System.out.println();

2. What output will be produced by the following code?

char[ ] vowels = { 'a', 'e', 'i', 'o', 'u' };
int index;
for (index = 0; index < vowels.length; index++)
{
System.out.println(vowels[index]);
}

3. What output will be produced by the following code?

double tide[ ] = {12.2, -7.3, 14.2, 11.3}
System.out.println("Tide 1 is " + tide[1]);
System.out.println("Tide 2 is " + tide[2]);

4. What is wrong with the following code to initialize an array b?
int[ ] b = new int[10];
int i;
for (i =1; i<=b.length; i++)
{
b[i] = 5*i;
}

5. Consider the following array:
int[ ] a = new int[10];
What is the last index of a? What is the value of a.length?

6. Write a complete Java program that will fill an array a with 20 values of type double read in from the keyboard, and that will output the numbers in the array as well as indicate how much each number differs from the last number in the input list. For example, if an array element is 2.0 and the last value in the input list is 5.0, the difference is 3.0. If an array element is 7.0 and the last value in the input is 5.0, the difference is -2.0. Assume that the users enter 20 numbers, one per line, from the keyboard. You should elaborate instructions to the user.

Monday, Dec. 3, 2012
Today we learned how arrays in Java work.

Q1: What are the advantages of using an array over multiple variables if you want to store the names of 260 students at TPS?

Q2:
a) Create an array that can store 12 integer values. Define each value manually.
b) Add to your code by writing a loop that prints out each value in your array.
c) Write a for loop that seeks the largest value in your array and then outputs it (prints it to the screen)

Q3: Write a code that makes the user enter 10 words in a for loop through the keyboard. After the loop is completed, the longest word and the shortest word should be outputted to the screen.

Q4: Write a code using a for loop in which the i th index of the for loop serves as the value of the i th index of the array. The array should be able to hold 30 values. The loop should iterate only 15 times.

Q5: Using a for loop, covert each of the 15 integer values of the Q4's integer array into doubles. These converted values should be stored in a new array of type double.


Tuesday, Nov. 27 - Friday, November 20, 2012

We reviewed all of the PowerPoints today in preparation for the test this Friday, November 30, 2012.

Monday, Nov. 26, 2012

Presentations

Will and Mohammad on Quantum Computers:
Jed on Monitors:

Matt on the History of Computer Science:

Jason on Monitors:

Thomas on Cell Phones:

Harris and Jean-David on Artificial Intelligence and Machine Learning:

Sam on the History of Hardware:

Eli and Aidan on the History of the Virus (please do a virus scan before opening this file):




Friday, Nov. 23, 2012

A) Read the following article:
http://www.extremetech.com/extreme/120229-ibm-shows-off-quantum-computing-breakthroughs-says-qubit-computers-are-close
B) Answer the following questions based on the article and e-mail your answers to me.

1. How soon may quantum computers become household devices?
2. Which company or institution do the quantum scientists work for?
3. What was the big discovery made?
4. What is the relationship between decoherence and the big discovery?
5. Describe the success rate of the logic operation.
6. This is probably your first time seeing pictures of quantum computers. In what ways do they look similar or different than conventional computers (or silicon based chips)?
7. What has IBM said about the information capacity of quantum computers in relation to the number of atoms in the universe?
8. Describe some of the issues with the practical use of quantum computers.
9. If you read IBM's article on this story,
http://www-03.ibm.com/press/us/en/pressrelease/36901.wss
Summarize within half a page (single-spaced) how quantum computing works.
10. Through online research, compile a list of the different institutions that are doing research on computer computers.
11. E-mail your answers to me otherwise you will be kept in after school on Monday to complete this.
12. Have a great weekend!


Tuesday, Nov. 13 - Thursday, Nov. 22, 2012
ICS3U Progress in Computers, Computer Science, and Technology in Society
Group Project:


Friday, Nov. 9, 2012
Homework Questions:
Study for the quiz as described in class today. Please write out the Purchase class (immediately below under Thursday, November 8th) without looking at the answer I provided in class that everyone has copied it. Look at the answer only if you have to.
1) Please know the difference between a void method and a return method. What do each of them do? Can you provide an example of each?
2) What are accessor and mutator methods? When are they used? Can you provide an example of each?



Thursday, Nov. 8, 2012
Today in class, we are examining a UML (Universal Modeling Language) class diagram. It basically tells you the instance variables and the methods you should have.

We will be working on the following class called Purchase:

Purchase
- name: String
- groupCount: int
- groupPrice: double
- numberBought: int

+ setName(String newName): void
+ setPrice(int count, double costForCount): void
+ setNumberBought(int number): void
+ readInput(): void
+ writeOutput(): void
+ getName(): String
+ getTotalCost(): double
+ getUnitCost(): double
+ getNumberBought(): int

Sample Screen Dialog

Enter name of item you are purchasing:
pink grapefruit
Enter price of item as two numbers.
For example, 3 for $2.99 is entered as
3 2.99
Enter price of item as two numbers, now:
4 and 5.00
Enter number of items purchased:
0
Number must be positive. Try again.
Enter number of items purchased:
2
2 pink grapefruit
at 4 for $5.0
Cost each $1.25
Total cost $2.5




Wednesday, Nov. 7, 2012
In the code that we did, with regards to the follwing,

speciesOfTheMonth.set("Klingon ox", 10, 15)

Could we have used the following code instead?

speciesOfTheMonth.name = "Klingon ox";
speciesOfTheMonth.population = 10;
speciesOfTheMonth.growthRate = 15;


Tuesday, Nov. 6, 2012

1. Design a class in Java called CarDealership. It should consist of the public variables carName, yearOfMake, distanceDriven, and repairRate.
a) Write a void method called writeOutput(). The public variables should be provided pre-defined values in the main method. This means that you do not need a Scanner class. We will simply set the values of these public variables in the main method manually. In the method writeOutput(), the details of the car (such as its name, year of make, distance driven and the number of times it has gone in for repair per year) should be displayed as output.
b) Create a main method in a different file that uses CarDealership so that a dealer can set the values of the public variables and run the writeOutput() method.
c) Show me that your coding works.
d) Write a return method called carLifeOver(). Keep in mind that this is not a void method. The age of the car should be calculated (subtract the year it was made from 2012) and store it in a non-public variable within this method. If the number of repairs exceeds 13, the dealer should be notified that this car's life is over, otherwise, the dealer should be notified the number of repairs that remain before the car's life is over.

2. Suppose Employee is a class with a void method named readInput() and dilbert is an object of the class Employee. So dilbert was named and created by the following:

Employee dilbert = new Employee();

Write an invocation of the method readInput() with dilbert as the calling object. The method readInput needs no information in parentheses.

3. Suppose you live in an idealized world where every species has exactly the same number of male and female members in its population. Give the definition of a method, called femalePopulation(), that you could add to the definition of the class SpeciesFirstTry. The method femalePopulation() returns the number of females in the population. If the population is an odd number, you have one species member left over after pairing; assume that member is a female. For example, if the population is 6, there are 3 males and 3 females. If the population is 7, there are 3 males and 4 females. Also, give the code of a method called malePopulation() that similarly returns the number of males in the population. Hint: the codes are very short. The bodies of the methods are slightly different.

4. Re-write the code for question 1 in new files such that the class allows the user to also make use of the Scanner class and enter in data from the keyboard. To do this, create a void method called readInput().





Thursday and Friday, Nov. 1 & 2, 2012
Homework:
1)
a) Add code to our SpeciesFirstTry class we wrote by adding two more public variables called height and weight.
b) Create a void method called bodyStructure(). Inside this method, the keyboard should be used to allow the user to enter the height and weight of the specie.
c) Create a void method called outPutBodyDetails() which prints to the screen the height and weight of the specie in a professional manner.

2) When do you use a void method or a return method?


Wednesday, Oct. 31, 2012

Write a class and a main program for each of the following problems.

1) In a class, you should have the public variable diameter and a method called calculateArea(). In your main program, the user should be able to set the value of diameter and the area calculation should be appear as output. Professional prompts must be used.

2) Make a class that has two public variables speed and time. A method should be written that calculates the distance traveled. In your main program, the user should be able to set the values of speed and time that a car is traveling and the distance the car travels should appear as output. Professional prompts and conclusions must be used.

3) Given the following method and corresponding output, make the class for to make it work:


public class Question3
{
public static void main (String [] args)
{
Froggy myFrog = new Froggy();
myFrog.numRibbits = 4;

myFrog.hearNumRibbits();
}
}

Output:
Your frog ribbits 4 times:
Ribbit
Ribbit
Ribbit
Ribbit




Tuesday, Oct. 30, 2012

Today, we were introduced to cryptography. We were able to shift each letter in a sentence.

Homework: Write a code that uses the quadratic equation to shift letters in a sentence.
For example, each letter is shifted a quadratic amount. Your for loop should continue looping until it reaches the quadratic number.
The first letter is shifted 1 down, the second letter is shifted 4 down, the third letter is shifted 9 down, the four letter is shifted 16 down, and so forth.
You need to have many variables who are being updated and used in the for loop to make it last longer in shifting letters down.

E-mail me your homework to azuberi@torontoprepschool.com. If you do not e-mail me, you will have
detention.

Monday, Oct. 29, 2012
We wrote a quiz today on for loops, while loops, and boolean logic.

Wednesday, Oct. 24 - Friday, Oct 26, 2012

Problems with Loops:

Problem #1:

Write a program that allows a user to enter ten temperatures. At the end of the program, the average temperature is calculated. The program should only consider temperatures between -7.0 and 23.5 deg. C. Numbers within this range are considered proper temperatures. If the entered temperatures are outside this range, the user is required to repeatedly enter a temperature until it qualifies as a proper temperature. Use proper communication in prompting the user.

Problem #2:

Write a program for that can display the following output.

Would you like to describe two of your thoughts?
Yes
Write one thought that comes to your mind:
I think this question is easy
Write a second thought that comes to your mind:
Hmm.. I think the temperature will be decreasing soon
Would you like to describe two of your thoughts?
No
Thank you for describing your thoughts to me.


Problem #3

What's the difference in output if you were to enter a sentence of five words given the following:

String sentence1 = s.nextLine();
System.out.println(sentence1);

String sentence2 = s.next();
System.out.println(sentence2);


Tuesday, Oct. 23, 2012
In class work:

1) If you define a characters with char x = 'a'; what happens if you write x++ on the line below it and print x? What is the outcome of incrementing (++) a character?

2) Use a single for loop to print out the next letters in the alphabet by using System.out.print(x). Notice that the "ln" at the end of the print statement is not needed if you want items to be printed beside each rather than being printed on the next line. Example:
ABCDEF

3) Using the knowledge gained from questions 1 and 2, use a double for loop to output:
ABCDEF
ABCDEF
ABCDEF
ABCDEF
ABCDEF

4) Write a nested for loop that outputs the following:
1
12
123
1234

5) Write a nested for loop that outputs the following:

ABCDE
ABCD
ABC
AB
A

5) Write a nested for loop that outputs the following:
*

*

*

6) Write a nested for loop that completes the triangle above by adding the bottom portion to it.



Monday, Oct. 22, 2012
Quiz

Friday, Oct. 19, 2012
Complete Q# 2 and 3 on the handout provided in class.

Tuesday, Oct. 15, 2012

Having learned while loop statements in Java, the goal is to utilize our knowledge of programming and Boolean logic into while loops. Complete the following questions.

Problem #1
The manager at ExpressKo wants you to write a Java program that allows a user to enter in a company's password at most three times. If the password is successfully entered, the program should output a welcome statement. If the password was not correctly entered within three attempts, the program should output a statement that notifies the user that they are a possible hacker and that security is on its way! (Hint: you may have a counter that keeps track of the number of times an entered password is wrong)

Problem #2
Write a Java program that allows you to enter two numbers such that as long as the numbers are between 4 and 16, all the numbers in between the ones you entered are added together. For example, if 5 and 9 are entered in, the program calculates and outputs the sum the numbers in between (6+7+8 which equals 21). If numbers are not entered between 4 and 16, then an output statement is provided alerting the user of the invalid input.

Problem #3
a) Design a real-world scenario that makes use of if-else statements and while loops.
b) Write the code for part a).





Monday, Oct. 15, 2012

Today, we are looking at Java loop statements. Write Java programs that will have the following sample display outputs using the while loop.

Problem # 1

Enter a number greater than 5:
7
All the numbers that precede 7, from smallest to largest, are as follows:
1
2
3
4
5
6


Problem # 2

Enter a number greater than 5:
7
All the numbers that precede 7, from largest to smallest, are as follows:
6
5
4
3
2
1


Problem # 3

Enter a positive whole number greater than 10:

12
This means that all the numbers that precede 12 added together equal
66


Problem # 4

Enter your age:
4
This means that in
In 2008, you were 0 years old.
In 2009, you were 1 year old.
In 2010, you were 2 years old.
In 2011, you were 3 years old.


Problem # 5

Enter the year you bought a condominium:
2009
Enter the value of your condo in 2009 (entered value is assumed to be in dollars):
275000
Enter the depreciation of the condo each year:
5000
Given the data you have entered, the following is true:
In 2010, the value of your house was 270000.
In 2011, the value of your house was 265000.


Problem # 6


Thursday, Oct. 11, 2012
We had a quiz today. No homework.

Wednesday, Oct. 10, 2012
Today's class will examine the importance of if-else statements. The lesson will be continued since we had a special presentation on ALS today. Please prepare for the quiz we have tomorrow. The best way to prepare is to redo the questions from the Oct. 5 homework (below) without looking at the posted solutions.



Tuesday, Oct. 9, 2012
1) Tests will be handed back and corrections need be completed in class.
2) Solutions to some of the questions from last week are posted below the questions (see Friday Oct. 5th homework immediately below). Now that you have the solutions, make sure you redo the homework (if it needs to be corrected) and have it all completed otherwise Saturday Club will give you the time to complete all the questions over the last two weeks.
3) Thursday, Oct. 11, 2012, Quiz on If-Else Statements / Boolean Logic (which includes all material covered in the course)

Friday, Oct. 5, 2012
Questions to be completed in class:

Write separate Java programs for each of the following problems.

1. a) Robert Jay Lifton wants to ensure that the fuel capacity matches the first condition in rules and regulations outlined in NASA's handbook. The program first checks if the user's name (who is entering the fuel load) is indeed Robert Jay Lifton, otherwise the user must be told that the appropriate engineer is needed to enter in the fuel data. When valid inputs are entered, the program should output the fuel load and the name of the user. After entering names (from the keyboard), there needs to be a second check (that is independent from checking the name) that the number entered is between 20,008.50 L to 20,047.20 L, otherwise the user must be told that the fuel load entered is incorrect.

Solution:

Oct 5 Q1 Part A.png
b) The NASA programmer is asked to modify the above code so that the two conditions are all checked at once.

Solution:
Oct 5 Q1 Part B.png


2. a) SpacExplora makes the robotic arms for CSA (the Canadian Space Agency). SpacExplora wants a Java program that makes sure that the arm radius entered (through the keyboard) is either between 30.7 m to 84.1 m or between 147.9 m to 188.4 m. This way, that arm can approach and grab something directly (the shorter distance) or it can be extended to grab an object from the other side. If the input satisfies these conditions, the user is notified that the robot arm is enabled and is following protocol. Otherwise, the user is informed that the data entered is invalid.

Solution:

Oct 5 Q2 Part A.png

b) Extend your program to include a calculation of the distance the end of the robotic arm travels. This applies to valid data entered. If the robot arm takes a shorter path, then it travels only 90 degrees . If the robot arm takes a longer path, then it travels 360 degrees. The user should see output that re-states the arm length and the distance it covers. The distance covered by the end point of an arm is basically the circumference of a circle which is 2*Pi*Radius. 360 degrees would be the full circumference and 90 degrees would be a quarter of the circumference.

3. Write a program that checks if a word that is entered (through the keyboard) is equal to "Yes", "No" or "Maybe". If the input is "Yes" then a 3 should be displayed, if it's a "No" then a 2 should be displayed, if it's a "Maybe" then a 1 should be displayed. If the input is neither of the three valid responses, a 0 should be displayed.

4. Write a program that outputs "Excellent", "Good", "Satisfactory", or "Needs Improvement", corresponding to marks in the same order: 80-100%, 70-79%, 60-69%, and 0-59%. The mark is entered through the keyboard.



Thursday, Oct. 4, 2012
Programming questions to be completed in class:

Complete Questions 1 - 5 on the worksheet provided in class.


Wednesday, Oct. 3, 2012
Quiz on Programming basics

Monday, Oct 1 - Tuesday, Oct. 2, 2012:

Homework Questions:

1. Without using Dr.Java, track the change in values and determine the final value. If you can do it without Java, you can do well on the Quiz coming up this Wednesday.

a)

int x = 15;
int y = x;
y = y/3;
System.out.println(y);

b)

String sentence = "Hey How Are Ya?";
int x = sentence.length();
int y = x/2;
System.out.println(y);

c)

String sen = "Mary, Mary, Mary, Mary, hey Mary!";
int lastPosition = sen.lastIndexOf("Mary");
System.out.println(lastPosition);





Friday, Sept. 28, 2012 Work:
Complete the following questions.

1. a) The string method used below is called compareTo. What it does it exactly what you expect it to do. It compares one thing to something else. The way you apply this string method is by writing the name of the string, and then attaching a .compareTo() to the right of it. In general, this is how you apply methods. Write the following code as the body of your Java program. What result does it produce?

String word = "hello";
System.out.println(word.compareTo("monkeymonkeymonkeymonkey"));


b) Now what is being compared to is different. What result does it produce now?

String word = "hello";
System.out.println(word.compareTo("hello"));


c) What result shows that two strings being compared are exactly the same?

d) What type of result shows that two results are different.

2. a) Compile and run the code below and explain what the string method it is doing.

String sentence = "Hello how are you?";
System.out.println(sentence.indexOf("you"));


b) Since Java begins counting from the number 0 (for example, the first letter of sentence is H and it is at a position of 0, the e is at a position of 1, the l is at a position of 2, and so forth), what does the answer to question above mean?

c) Many surveys require you to write your first name, middle name, and last name. Explain how the indexOf string method can be useful in a variety of ways if you are coordinating the survey.

d) Explain what the following code does.

int x;
String sentence = "Hello how are you?";
x = sentence.indexOf("you")
System.out.println(x);



3. A recognized string method is called substring.
a) Compile and run the code below and explain what the string method it is doing.

String name = "Mr. Zuberi";
System.out.println(name.substring(4,7));


b) Do you agree that what you insert inside the brackets of this string method can be described by .substring(starting point, end point)? Explain your thoughts.

4. Now that you have an idea of how to use string methods, you are to come up with a realistic, well-planned, survey that is filled out by a customer that makes use of the String methods.

5. I have decided that those of you who have not e-mailed me any homework will be enrolled in homework club.


Thursday, Sept. 27, 2012 Work:
Complete the following questions. Use Java to decipher each question.

1. a) What does the code below output?
---
String word = "Hello how are you";
System.out.println(word.indexOf("you"));
---

b) Since Java begins counting from the number 0 (for example, the first letter of the String is H and it is at a position of 0, the e is at a position of 1, and so forth), what does the answer to question above mean?

2. E-mail me yesterday's homework on the BBC article.





Wednesday, Sept 26, 2012 Work:
I hope to be back tomorrow. For today's class, you must complete the following and e-mail it to me otherwise you are in for homework club. We may also have a pop quiz on it and for those who have the work below completed can simply ace the quiz.
A) Read the BBC article on pushing the limits of the human mind through computer technology (in case you can't access the link below, I have copied the article below the questions):
http://www.bbc.com/news/technology-15200386
B) Answer the following questions based on the reading. Answers should be in your own words.
1. What was the name of the testing room in England?
2. Describe how the headset looks like and what it does.
3. How made the headset? Is this expensive equipment or is it generally a low cost equipment?
4. What did the researchers link the headset to?
5. Describe the sources that that control signals emerge from.
6. How was this technology help the patient that experimented with?
7. Discuss the Swiss contributions in using this technology.
8. Does IBM's readings (which instruct the robot) come from brain waves? If not, explain where they come from.
9. Does EPFL and Nissan's implementation use brain waves? For what purpose to they use it?
10. Explain whether you would feel safe with using this implementation for driving an automobile. (Minimum 3 sentences)
11. Summarize BrainGate's contributions to this are of technology. (Minimum 3 sentences)
12. Professor Noel Sharkey of the University of Sheffield said "Imagine some kind of a wireless computer device in your head that you'll use for mind control - what if people hacked into that?" Do you believe that such a hacking threat should restrict the use of such technology from the public and make it accessible only to certain research labs? (Minimum 3 sentences)
13. The article states that the current research is focused on converting "analogue thoughts into digital information links human beings directly to electronic information networks, such as the internet." Research online the explain difference between analogue and digital information. (Minimum 3 sentences)
14. Professor Sharkey warns of the use of such technology if the military gets a hold of it. Describe his example and discuss whether you think his reasons are realistic or not. Are his thoughts about the possibility of cybercrime more realistic? (Minimum 4 sentences)
15. State how this article has changed your views on the power of technology when connected to the brain. (Minimum 4 sentences)



Real-life Jedi: Pushing the limits of mind control | 10 October 2011
Description: Katia Moskvitch
Description: Katia Moskvitch
By Katia Moskvitch Technology reporter, BBC News

The inner workings of the brain can now be read using low cost hardware
You don't have to be a Jedi to make things move with your mind.
Granted, we may not be able to lift a spaceship out of a swamp like Yoda does in The Empire Strikes Back, but it is possible to steer a model car, drive a wheelchair and control a robotic exoskeleton with just your thoughts.
Description: Ideas that could change the world
Description: Ideas that could change the world

Some ideas, some technologies may sound like science fiction, but they are fast becoming science fact. In our eight-part series we will be exploring ideas that are the future of technology.
"The first thing is to clear your mind…to think of nothing," says Ed Jellard; a young man with the quirky title of senior inventor.
We are standing in a testing room at IBM's Emerging Technologies lab in Winchester, England.
On my head is a strange headset that looks like a black plastic squid. Its 14 tendrils, each capped with a moistened electrode, are supposed to detect specific brain signals.
In front of us is a computer screen, displaying an image of a floating cube.
As I think about pushing it, the cube responds by drifting into the distance.
Admittedly, the system needed a fair bit of pre-training to achieve this single task. But it has, nonetheless, learned to associate a specific thought pattern with a particular movement.
The headset, which was developed by Australian company Emotiv for the games industry, has been around for some time. But it is only now that companies such as IBM are beginning to harness the wealth of data that it can provide.
Using software developed in-house, researchers have linked the Emotiv to devices such as a model car, a light switch and a television.
Control signals come from two main sources; electroencephalography (EEG) measurements of brain activity, and readings of nerve impulses as they travel outwards to the muscles.
Description: MindSet headset
Description: MindSet headset
There is now a variety of brainwave-reading headsets on the market, mostly used for video gaming

Restoring movement
New techniques for processing such information are enabling sophisticated real world applications.
Already the team has used the system to help a patient with locked-in syndrome, whose healthy, active mind became trapped in a motionless body following a stroke.
“Start Quote
We linked the headset to the IBM middleware, and when he pushed the cube on the screen, that behaved like a click of the mouse”
Kevin Brown IBM
"We linked the headset to the IBM middleware, and when he pushed the cube on the screen, that behaved like a click of the mouse - so he was able to use the computer," explained IBM's Kevin Brown.
Many commercial mind control technologies are designed to restore physical ability to those who have lost it.
At Switzerland's Ecole Polytechnique Federale de Lausanne (EPFL), researchers have applied brain-computer interface technology to create thought-controlled wheelchairs and telepresence robots.
"A disabled patient who can't move can instead navigate such a robot around his house to participate in the social life of the family," explains the team leader, Professor Jose del Millan.
"To do that, a helmet detects the intention of some physical movement and translates it into action."
Description: Prof. Sankai, CYBERDYNE, Inc./Univ. of Tsukuba
Description: Prof. Sankai, CYBERDYNE, Inc./Univ. of Tsukuba
Brain-controlled Cyberdyne's Hal suit allows disabled patients to walk again

Japanese company Cyberdyne is helping people who cannot walk to regain mobility by dressing them in a full-body robotic suit called Hal.
Just as some of IBM's readings come from nerve impulses, rather than brain waves, Cyberdyne uses tiny sensors on the limbs to measure the subject's intention to move, even if the physical act is impossible.
“Start Quote
A disabled patient who can't move can instead navigate such a robot around his house to participate in the social life of the family”
Prof Jose del Millan EPFL
The robot body responds by moving its arms or legs. Webcams and computer screens enabling the user to pilot their machine and communicate with friends and family through their proxy body.
Outside the healthcare field, another implementation, being developed by EPFL in partnership with car maker Nissan, is an intelligent vehicle that can use brainwave data.
Supported by numerous external sensors and cameras, brain wave sensors read what the driver is planning to do next.
Having anticipated their intentions, the car takes over, eliminating the need for tedious and time consuming physical movement.
For those who prefer pedal power, Toyota is working with Saatchi & Saatchi, Parlee Cycles and DeepLocal to develop a bicycle which can shift gear based on its rider's thoughts.
Description: Prototype of an intelligent car
Description: Prototype of an intelligent car
In future, cars might be able to assist the drivers by reading their brainwaves

Suits and microchips
Headsets and helmets offer cheap, easy-to-use ways of tapping into the mind. But there are other, more invasive techniques being developed.
“Start Quote
Imagine some kind of a wireless computer device in your head that you'll use for mind control - what if people hacked into that”
Prof Noel Sharkey University of Sheffield
At Brown Institute for Brain Science in the US, scientists are busy inserting chips right into the human brain.
The technology, dubbed BrainGate, sends mental commands directly to a PC.
Subjects still have to be physically "plugged" into a computer via cables coming out of their heads, in a setup reminiscent of the film The Matrix. However, the team is now working on miniaturising the chips and making them wireless.
BrainGate is developing ways of using the output to control a computer cursor, on-screen keyboard, and even manipulate robotic arms.
After testing it on monkeys, the scientists have now started human trials. Lead researcher Prof John Donoghue hopes that one day, his groundbreaking research will help people with spinal cord injuries or locked-in syndrome to walk again just by thinking of moving their limbs.
Description: Cyclist, mind-controlled bicycle
Description: Cyclist, mind-controlled bicycle
Mind controlled bikes would change gear at the flick of a thought

Robot warriors?
But extracting information from the brain, be it by internal or external sensors, is only part of the story.
Much of the current research effort is looking at how to efficiently process and utilise the vast streams of data that the brain produces.
Turning analogue thoughts into digital information links human beings directly to electronic information networks, such as the internet. The brain becomes yet another sensor to be analysed and interrogated.
And as techniques for crunching that output get more sophisticated, the technology it drives will move beyond simple device control.
"People like data," said IBM's Ed Jellard. "So if you can see patterns of data, the geekier people will be very interested to see what is going on in their brain and how it is changing over time.
"I would be interest to know if my brain is getting stronger and if I have more intense thoughts. Things like that could be useful."
“Start Quote
If you can see patterns of data, the geekier people will be very interested to see what is going on in their brain and how it is changing over time”
Ed Jellard IBM
While it is possible to translate brain waves into machine processable data, there remains something unique and special about those signals that rocket around inside our skulls.
They are not the same as lasers in a fibre optic cable or electrons in a microprocessor, and tapping the mind will raise philosophical and ethical questions, according to Prof Noel Sharkey.
"Once the military get a hold of it, they will push it very hard," he explains.
"At the moment they are filling the airspace in Afghanistan with drones that only one person can control - but if they get the helmets well enough developed, they'll be able to control a number of planes or robot warriors directly with their thoughts."
There are also questions about what form cyber crime would take in the age of the wired mind?
"Imagine some kind of a wireless computer device in your head that you'll use for mind control - what if people hacked into that, what could they do to you and your property?," continues Prof Sharkey.
"And what if you are forced to wear a device and someone controls you with his thoughts, making you do things?..."
The possibilities, both positive and negative, are literally mind boggling.








Tuesday, Sept 25, 2012 Work:
My dear computer geniuses, I am sick again. But that should not prevent you from your pursuit of higher education, because you have to complete the following:

1) The teacher who will take over my class will provide you photocopies of something called "String Methods". There are two different pages you will receive - both pages are double sided. These pages will give you the power to dissect user inputs using String methods. For example, you will be able to tell how many characters a user input is or if there are certain letters of interest within the user input. Read all of the pages. The very last page shows an example of how to use String methods.

2) After you have read and understood String methods, you are to create two different examples (Java programs) on your own that demonstrate the use of each String method.

3) By this point, you would have a good idea of String methods. To complete the day, you are to come up with a realistic, well-planned, survey that is filled out by a customer that makes use of the String methods.

4) E-mail it to me at azuberi@torontoprepschool.com. I will certainly read your work while I'm trying to get some rest and as for you, all the best! Sincerely, Mr. Zuberi.

Sept. 17 - 21, 2012 Homework


Friday, Sept 21, 2012 Work:
Review your notes.

Thursday, Sept. 20, 2012 Work:
Study for the quiz tomorrow.

Wednesday, Sept. 19, 2012 Work:
My amazing CS students, I have provided below the code for the questions we practiced today in class. Below these codes, I have two homework questions for you to e-mail to me.
_ _ _ _ _ _ _ _ _ _ _ _ _ _
IN CLASS WORK:

1. Write a Java program that will provide the following output display:
- - - -
Enter the radius of a circle:
2.7
If the radius of the circle is 2.7, then the
area of the shape is 22.89 and the
circumference is 16.95.

SOLUTION SKETCH

Scanner s = new Scanner(System.in);
double radius = s.nextDouble();
double area = 3.14*radius*radius;
double circumference = 2*3.14*radius;

System.out.println("If the radius is " + radius + ", then the area is " + area + " and the circumference is " + circumference);

- - - - - - - - - - - - - - - - - -- - - - - - -
2. Write a Java program that displays the following output:
- - - - - -

Enter the principal value of your investment:
2500
Enter the interest rate:
7
If the formula for the value of your future investment is
futureValue = principle*(1+ interest / 100), then by calculating this,
the future value of our investment should be
2675

SOLUTION SKETCH

Scanner s = new Scanner(System.in);
double principal = s.nextDouble();
double interest = s.nextDouble();
double future = principal*(1 + interest / 100);

System.out.println("The future value is " + future);

_ _ _ _ _ _ _ _ _ _ _ _

Homework Questions for Wed. Sept 19, 2012:

1. Write a Java program that takes in

2. Write a Java program that takes in three separate words through user input and then prints out a sentence combined with those words in order with the proper spacing between each word. Hint: If the name of your Scanner is s, then command for inputting words is s.next(). Look at your past coding exercises in class if needed.


Tuesday, Sept. 18, 2012 Work:
My dear awesome class, complete the worksheet provided in class - Q#1-9

Question 9: What is the output produced by the following lines of program code?

char a, b;
a = 'b';
System.out.println(a);
b = 'c';
System.out.println(b);
a = b;
System.out.println(a);




Monday, Sept. 17, 2012 Work:
My dear awesome class, the homework:

1) The code we wrote for the hard question is not actually hard. What makes it hard is that there are a lot of words in the way. A few students figured it out right away because they simply looked at what was happening to the numbers first and then they included the wordy sentences later on. The working of the raw input/output numbers is shown in the following code. Copy and paste this into Dr. Java and see if you can follow what each line is doing.

--
import java.util.*;

public class ExerciseInClass
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
int NumEggs = keyboard.nextInt();
int NumBaskets = keyboard.nextInt();

int Eggs1 = NumEggsInBasket*NumBaskets;
System.out.println(Eggs1);

System.out.println("Now we take two eggs out of each basket.");
int newNumEggs = NumEggs - 2;
int Eggs2 = newNumEggs*NumBaskets;

System.out.println("The new total number of eggs is " + Eggs2);
}
}
---
The actual code we wrote in class is below.
---
import java.util.*;

public class ExerciseInClass
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter the number of eggs in each basket:");
int NumEggsInBasket = keyboard.nextInt();
System.out.println("Enter the number of baskets:");
int NumBaskets = keyboard.nextInt();
System.out.println("If you have");
System.out.println(NumEggsInBasket + " eggs per basket and");
System.out.println(NumBaskets + " baskets, then");
int totalInitialEggs = NumEggsInBasket*NumBaskets;
System.out.println("the total number of eggs is " + totalInitialEggs);
System.out.println("Now we take two eggs out of each basket.");
int newNumEggsInBasket = NumEggsInBasket - 2;
int totalNewEggs = newNumEggsInBasket*NumBaskets;
System.out.println("The new total number of eggs is " + totalNewEggs);
}
}
--

2) Write a program that provides the following output based on the numbers the user inputs. The input/output numbers are in bold. Make sure you have imported the required item in order to input information. In this question, we are adding numbers. Sample input/output:
--
Enter the number of female elephants at the zoo:
5
Enter the number of male elephants at the zoo:
2
If there are 5 female elephants and 2 male elephants, then there may be at least
7 baby elephants that might be coming soon!
--

3) Here's a new question. Write the following into the body of your code. Make sure you have your import as required. For the input, type a word.
--
Scanner keyboard = new Scanner(System.in);
String word = keyboard.next();
System.out.println(word);
--
Question: If the command for inputting a number is keyboard.nextInt(), what is the command to input a String according to the code above?




Sept. 10 - 14, 2012 Homework


Friday, Sept. 14, 2012 work:
My fellow computer prodigies, please answer the following questions over the weekend. E-mail your answers to me (the raw text) to azuberi@torontoprepschool.com

1. Tom works at Burger King and makes $14 per hour. The manager wants to know how much he has to pay Tom depending on the hours Tom has worked.
a) What "type" of data should you use? Type int or double?
b) Write a program that helps the manager. Make sure your program has variables that are appropriately named. An example of the interaction is as follows:
If Tom works for, say for example 6 hours, then the output should be 84.

2. Kelly is a financial adviser at a local bank and she has a formula that outputs the increase in a person's income by 7.0%.
a) What "type" of data should you use? Type int or double?
b) If the formula is NewIncome = 1.07*OldIncome a new person , write a program that helps Kelly calculate a person's new income. An example of the interaction is as follows: If Kelly inputs an income of 52000.0, she should receive an output of 55640.0

3. What does a compiler do to Java's high-level language?

4. Debug the following code and make it work.

public class FindY2KBug
{
public static void main (String [] args);
{
system.out.println("As it approaches 12:00 AM, January 1, 2000,")
system.out.println("the Y2K but will occur and all computers will stop working")
}
}

5. At NASA's Jet Propulsion Laboratory, a research scientist learns that a programmer has inputted 20000 liters of fuel for the rocket which of type int.
a) copy and paste the code below into Dr. Java, compile and run it.
b) In the formula on line 7 from the top, multiply the OriginalFuel by 1.0 and then compile and run it.
c) Has the NASA scientist succeeded in preserving the original input of his programmer friend and simply modified the input to obtain a decimal number?

public class FuelRevisionNASA
{
public static void main (String [] args)
{
int OriginalFuel = 20000;
double RevisedFuel;
RevisedFuel = OriginalFuel;

System.out.println(RevisedFuel);
}
}

6. Review primitive types:
PRIMITIVE TYPES

Type Name
Kind of Value
Memory Used
Size Range
byte
Integer
1 byte
-128 to 127
short
Integer
2 bytes

int
Integer
4 bytes

long
integer
8 bytes

float
floating-point number
4 bytes

char
Single character (Unicode)
2 bytes

boolean
true or false
1 bit


7. E-mail your homework to me. Have a great weekend !



Thursday, Sept. 13, 2012 work:
My fellow computer scientists, answer the following questions in your own works independently upon reading An Illustrated History of Computers
and e-mail your answers to azuberi@torontoprepschool.com. Don't rush through this work. Read it all carefully and try to absorb the history for your own learning which you may have to demonstrate on Friday.

1) Explain in what sense why people should be considered as the first computers? (2 sentences minimum)
2) What is the remarkable thing about the abacus if it's used by a person who is skilled in using it? (2 sentences minimum)
3) Who pioneered logarithms and what did logarithms allow us to do? (2 sentences minimum)
4) How did this pioneers work help NASA? (2 sentences minimum)
5) What was da Vinci trying to convey in his drawing? Did his work ever result into a physical world.
6) Describe the purpose of the first gear-driven machine and who was the person who designed it?
7) Describe Pascal's contributions and their relationship with speedometers.
8) Who made a major contribution after Pascal and what did he advocate?
9) What materials did Jacquard use and what function did his work have?
10) Charles Babbage made major developments to computer science. In six sentences, properly summarize his work and how he overcame the obstacles he faced.
11) How did Hollerith impact the history of computers and what major company resulted from his work? How was this significant to political votes?
12) What affect did the military have on the advancements in computers?
13) How did Grace Hopper help the world of detecting errors in computer programs?
14) What was the humorous note by the Harvard scientist?
15) Describe how the Applie I looked like.
16) Just before 1970, which computers were gaining attention?



Wednesday, Sept. 12, 2012 work:
1) Have student volunteers take up the homework on my wiki on the white board.
2) Students should quietly and independently work on the following that requires online research and programming:

A) Is Java is a high-level language or a low-level language?
B) What is a compiler?
C) What is a source program?
D) What does the word “import” generally mean?
E) Write out the following code. Do not copy and paste it. If you simply copy and paste it, you will only hurt your own learning and performance on the test. Compile it and run it. Answer the questions below the code.
--
import java.util.*;
pubic class FirstProgram
{
public static void main (String [] args)
{
System.out.println(“Hello out there.”);
System.out.println(“I will add two numbers that you will choose.”);
System.out.println(“Enter two whole numbers on a line:”);

int n1;
int n2;

Scanner keyboard = new Scanner(System.in);


n1 = keyboard.nextInt();
n2 = keyboard.nextInt();


System.out.println(“The sum of those two numbers is”);
System.out.println(n1 + n2);
}
}

F) What is being imported into your program? Explain with at least two sentences.
G) Yesterday, we worked with System.out, which refers to a form of output, but this time in the code, it says System.in when defining the word keyboard. What does System.in here refer to?
H) What is the “type” of keyboard?
I) Write your own code that makes the user input three words and adds them together such that they are all one white-space apart when your print them (when you compile and run it).
J) E-mail your homework to me (azuberi@torontoprepschool.com)




Tuesday, Sept. 11, 2012 Work:

1. Run the following code in your computer. Does it work or not? If not, why not?
--
int x = "5";
System.out.println(x);
--

2. Write out the structure that you need to memorize to begin the program with. This is the structure outside the main body where you do definitions in.

3. Without running the following code, write out exactly what you expect it to output.
a)
--
String sentence1 = "Hello there. How are you?";
String sentence2 = "My name is Mr. Zuberi. It's a pleasure to have you in my class.";
System.out.println(sentence1 + sentence2);
--
b) What should Mr. Zuberi do to correct the error that has been made.

4. Copy and paste the following code and run it. Correct what the error in it.
--
String s = "Testing. Testing. Testing";
String t = "yo yo yo";
String b = "1 2 3 1 2 3"
String x = "3+3+3";

System.out.println(s + t + b + x);

5. During the print output, can you add a string to an integer? What type is the final output in? Provide a sample code to demonstrate your explanation.





Monday, Sept. 10, 2012 Work:
Answer the following questions and e-mail them to Mr. Zuberi (azuberi@torontoprepschool.com) before 8 AM of the following day.

1. What are the two kinds of memory in a computer?
2. What is software?
3. Describe Mark Zuckerburg's view of the value of computer science. Explain whether you agree or disagree with him based on your observation of technology around us. *Minimum 5 lines.
4. Create your own drawing that explains how a computer's memory works. Show bytes, location, address, and the bits associated.
5. Research online the definition of "computer science" and explain what is means. *Minimum three lines.
6. Research online and describe the historical developments that were made in making Java, the programming language. *Minimum 4 lines.
7. Java is the programming language we will be using in class very soon. Download Dr. Java, the Mac OSX version from this website:
http://drjava.sourceforge.net/

// The Isosceles Right Triangle (made with capital letters)
for (outer = 'F' ; outer >= 'A' ; outer--)
{
for (inner = 'A' ; inner <= outer; inner++)
{
System.out.print(inner);
}

System.out.println( );
}